import QtQuick 2.6
import QtQuick.Controls 2.1

RadioButton {
    id: control
//    text: qsTr("RadioBtnColor")
    checked: true

    property string textcolor:"#FF000000"
    property string disabledtextcolor:"#FFA7A6AA"
    property string selectedtextcolor:"#FFFFFFFF"


    property string normalcolor: "#00000000"
    property string hotcolor: "#00000000"
    property string selectedcolor:"#00000000"

    property string foreimage: ""
    property string hotforeimage:""
    property string selectedforeimage:""


    indicator: Rectangle {
        implicitWidth: control.width
        implicitHeight: control.height
        radius: 4
        //border.color: control.down ? "#17a81a" : "#21be2b"

        color:
        {
            if(control.checked)
            {
                selectedcolor
            }
            else{
                if(control.hovered)
                {
                    hotcolor
                }
                else
                {
                    normalcolor
                }

            }
        }


        Image
        {
            id:foreimg
            x: 7
            y: 7
            width: 20
            height: 20
            source:
            {
                if(control.checked)
                {
                    selectedforeimage
                }
                else
                {
                    if(control.hovered)
                    {
                        hotforeimage
                    }
                    else
                    {
                        foreimage
                    }
                }
            }
        }
    }

    contentItem: Text {
        text: control.text
        font: control.font
        opacity: enabled ? 1.0 : 0.3
        color:{
            if(control.checked){
                selectedtextcolor
            }else{

                textcolor
            }
        }
        verticalAlignment: Text.AlignVCenter
        leftPadding: foreimg.width + control.spacing
    }

}
